import java.util.ArrayList;
import java.util.Scanner;


public class Sort {
	public static void main(String args[]){
		ArrayList <String> wordList= new ArrayList <String>();
		Scanner in;
		String word;
		boolean wordtime=true;
		while (wordtime==true){
			in= new Scanner(System.in); 
			word=in.nextLine();
			if (word.equalsIgnoreCase("stop"))
				wordtime=false;
			else
				wordList.add(word);
		}
		ArrayList <String> ReverseList= new ArrayList <String>();
		for (int flipper=0; flipper<wordList.size(); flipper++){
			String temp=wordList.get(flipper);
			String temp2=temp;
			for (int flipper2=0; flipper2<temp.length(); flipper2++){
				if (flipper2==0)
				temp=(temp2.substring(temp2.length()));
				else
				temp=(temp + temp2.substring(temp2.length()-flipper));
			}
			ReverseList.add(temp);
		}
		for (int counter=0; counter<ReverseList.size(); counter++)
			System.out.println(ReverseList.get(counter));
		/*
		String lowest;
		String temp;
		int swap=0;
		for(int counter=0; counter<wordList.size(); counter++){
			lowest=wordList.get(counter);
			swap=counter;
			for(int counter2=counter; counter2<wordList.size(); counter2++){
				if (wordList.get(counter2).compareToIgnoreCase(lowest)<0){
					lowest=wordList.get(counter2);
					swap=counter2;
				}
			}
			temp=wordList.get(counter);
			wordList.set(counter, lowest);
			wordList.set(swap, temp);
		}
		for (int counter=0; counter<wordList.size(); counter++)
			System.out.println(wordList.get(counter));
			*/
	}
}
